package com.mz.ozy.adapter;

import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mz.ozy.R;
import com.mz.ozy.bean.RoleListBean;
import com.mz.ozy.utils.glideUtils.GlideUtils;

import java.util.List;

/**
 * Created by administrator on 2018/11/21.
 */
public class RoleAdapter extends BaseQuickAdapter<RoleListBean.RoleBean, BaseViewHolder> {

    private int mSelectIndex = -1;

    public RoleAdapter(@Nullable List<RoleListBean.RoleBean> data) {
        super(R.layout.item_role_select, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, RoleListBean.RoleBean item) {
        helper.setText(R.id.tv_role_name, item.getUsername());

        if (1 == item.getXzJs()) {
            helper.setVisible(R.id.iv_role_select, true);
        } else {
            helper.setVisible(R.id.iv_role_select, false);
        }
        ImageView userIcon = helper.getView(R.id.iv_userIcon);
        GlideUtils.loadAvatar(mContext, userIcon, item.getUseravatar());

    }

    public void setSelectIndex(int pos) {
        mSelectIndex = pos;
        notifyDataSetChanged();
    }
}
